package com.cksys.achievement.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cksys.achievement.enums.EmailStatusEnum;
import com.cksys.achievement.enums.RegisterEnum;
import com.cksys.achievement.enums.SexEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;

/**
 * @author tadechen
 * @since 2019-09-26
 */
@Data
@Accessors(chain = true)
@TableName(value = "user", resultMap = "selectAllFiled")
public class User {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空！")
    private String username;

    /**
     * 密码
     */
    @NotEmpty(message = "密码不能为空！")
    private String password;

    /**
     * 真实姓名
     */
    @NotEmpty(message = "真实姓名不能为空！")
    private String realName;

    /**
     * 性别
     */
    private SexEnum sex;

    /**
     * 盐值
     */
    private String salt;


    /**
     * 邮箱
     */
    @Email(message = "邮箱格式错误！")
    private String email;

    /**
     * 绑定的qq id
     */
    private String token;

    /**
     * 头像地址
     */
    private String avatarPath;

    /**
     * github用户唯一标识
     */
    private String accountId;

    private String qqId;

    /**
     * 判断用户是否审核通过
     */
    private RegisterEnum register;

    /**
     * 预留
     */
    private EmailStatusEnum emailFlag;

    @TableField(exist =  false)
    private String roleName;


}
